package evs.sample;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;
import org.hibernate.search.annotations.Store;

import evs.location.RESTful;

@RESTful
@Entity
@OccupationConstraint
@Indexed
public class Occupation
{
    @Id
    @GeneratedValue
    private Long id;

    @Field(index=Index.TOKENIZED, store=Store.NO)
    private String position;
    
    @Column(name="FROM_DATE")
    private Date from;
    
    @Column(name="TO_DATE")
    private Date to;
    
    @ManyToOne(optional=false)
    @IndexedEmbedded(depth=1)
    private Person person;
    
    @ManyToOne(optional=false)
    @IndexedEmbedded(depth=1)
    private Company company;
    
    
    public Long getId() { return id; }
    
    public String getPosition()
    {
        return position;
    }
    
    public void setPosition( String position )
    {
        this.position = position;
    }
    
    public Date getFrom()
    {
        return from;
    }
    
    public void setFrom( Date from )
    {
        this.from = from;
    }
    
    public Date getTo()
    {
        return to;
    }
    
    public void setTo( Date to )
    {
        this.to = to;
    }
    
    
    
    public void setPerson( Person person )
    {
        this.person = person;
    }
    
    public Person getPerson()
    {
        return person;
    }
    
    public void setCompany( Company company )
    {
        this.company = company;
    }
    
    public Company getCompany()
    {
        return company;
    }
}
